from django.db import models

class AcademicAchievement(models.Model):
    """
    学术成果表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    AchievementType = models.CharField(max_length=50, help_text="成果类型")
    AchievementName = models.CharField(max_length=100, help_text="成果名称")
    Notes = models.CharField(max_length=100, blank=True, null=True, help_text="备注（国家级/核心/普刊等）")

    class Meta:
        verbose_name = "学术成果"
        verbose_name_plural = "学术成果"

class AchievementType(models.Model):
    """
    成果类型表
    """
    ID = models.AutoField(primary_key=True)
    TypeName = models.CharField(max_length=50, help_text="类型名称")

    class Meta:
        verbose_name = "成果类型"
        verbose_name_plural = "成果类型"

class BookType(models.Model):
    """
    图书类型表
    """
    ID = models.AutoField(primary_key=True)
    TypeName = models.CharField(max_length=50, help_text="类型名称")

    class Meta:
        verbose_name = "图书类型"
        verbose_name_plural = "图书类型"

class ClassInfo(models.Model):
    """
    班级表
    """
    ClassID = models.AutoField(primary_key=True)
    Grade = models.IntegerField(help_text="年级")
    Major = models.CharField(max_length=50, help_text="专业")
    ClassName = models.CharField(max_length=50, help_text="班级")
    HeadTeacher = models.IntegerField(blank=True, null=True, help_text="班主任")
    Counselor = models.IntegerField(blank=True, null=True, help_text="导员")

    class Meta:
        verbose_name = "班级信息"
        verbose_name_plural = "班级信息"

class ClubParticipation(models.Model):
    """
    社团参与情况表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    ClubName = models.CharField(max_length=100, help_text="社团名称")
    ClubType = models.CharField(max_length=50, help_text="社团类型（学术/社团）")

    class Meta:
        verbose_name = "社团参与"
        verbose_name_plural = "社团参与"

class Consumption(models.Model):
    """
    消费情况表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    Expense = models.FloatField(help_text="本次支出")
    ExpenseTime = models.DateTimeField(help_text="时间")

    class Meta:
        verbose_name = "消费记录"
        verbose_name_plural = "消费记录"

class CourseInfo(models.Model):
    """
    课程表
    """
    CourseID = models.AutoField(primary_key=True)
    CourseCode = models.CharField(max_length=20, help_text="课程号")
    CourseName = models.CharField(max_length=100, help_text="课程名称")
    Credits = models.IntegerField(help_text="学分")
    CourseType = models.CharField(max_length=50, help_text="课程类型")

    class Meta:
        verbose_name = "课程信息"
        verbose_name_plural = "课程信息"

class CourseScore(models.Model):
    """
    课程成绩表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    CourseID = models.IntegerField(help_text="课程ID")
    AcademicYear = models.CharField(max_length=20, help_text="学年学期")
    StudyType = models.CharField(max_length=50, help_text="修读方式")
    IsRetaken = models.BooleanField(help_text="是否重修")
    UsualScore = models.FloatField(blank=True, null=True, help_text="平时成绩")
    FinalScore = models.FloatField(blank=True, null=True, help_text="期末成绩")
    TotalScore = models.FloatField(blank=True, null=True, help_text="总成绩")
    IsCrossDiscipline = models.BooleanField(null=True, blank=True,help_text="是否跨学科选修")

    class Meta:
        verbose_name = "课程成绩"
        verbose_name_plural = "课程成绩"

class HonorTitle(models.Model):
    """
    荣誉称号表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学生ID")
    TitleName = models.CharField(max_length=100, help_text="称号名称")
    TitleType = models.CharField(max_length=50, help_text="类型")

    class Meta:
        verbose_name = "荣誉称号"
        verbose_name_plural = "荣誉称号"

class LibraryBorrow(models.Model):
    """
    图书馆借阅信息表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学生ID")
    BorrowType = models.CharField(max_length=50, help_text="借阅类型")
    BookName = models.CharField(max_length=100, help_text="借阅书籍名称")
    Time = models.DateTimeField(help_text="日期")
    class Meta:
        verbose_name = "图书馆借阅"
        verbose_name_plural = "图书馆借阅"

class LibraryEntry(models.Model):
    """
    图书馆进出信息表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    EntryTime = models.DateTimeField(help_text="进入时间")
    ExitTime = models.DateTimeField(blank=True, null=True, help_text="出馆时间")
    HasBorrowed = models.IntegerField(help_text="是否借阅")

    class Meta:
        verbose_name = "图书馆进出记录"
        verbose_name_plural = "图书馆进出记录"

class PhysicalMentalHealth(models.Model):
    """
    身心健康依据表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    ClubActivityCount = models.IntegerField(blank=True, null=True, help_text="参加社团活动次数")
    PeerInteractionCount = models.IntegerField(blank=True, null=True, help_text="与同学交流次数")
    FriendCount = models.IntegerField(blank=True, null=True, help_text="好友数量")
    SportsCompetitionCount = models.IntegerField(blank=True, null=True, help_text="体育竞赛次数")
    Hobbies = models.CharField(max_length=255, blank=True, null=True, help_text="兴趣爱好")

    class Meta:
        verbose_name = "身心健康记录"
        verbose_name_plural = "身心健康记录"

class PhysicalTestScore(models.Model):
    """
    体测成绩表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    Semester = models.CharField(max_length=20, help_text="学期")
    Sprint50m = models.FloatField(blank=True, null=True, help_text="50米")
    Run1000_800m = models.FloatField(blank=True, null=True, help_text="1000/800米")
    PullUp_SitUp = models.IntegerField(blank=True,   null=True, help_text="引体向上/仰卧起坐")
    VitalCapacity = models.FloatField(blank=True, null=True, help_text="肺活量")
    SitReach = models.FloatField(blank=True, null=True, help_text="坐位体前屈")
    LongJump = models.FloatField(blank=True, null=True, help_text="跳远")
    BMI = models.FloatField(blank=True, null=True, help_text="BMI")
    TotalScore = models.FloatField(blank=True, null=True, help_text="总成绩")

    class Meta:
        verbose_name = "体测成绩"
        verbose_name_plural = "体测成绩"

class PsychCounseling(models.Model):
    """
    心理咨询记录表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    CounselingTime = models.DateTimeField(help_text="时间")
    CounselingEffect = models.CharField(max_length=100, blank=True, null=True, help_text="咨询效果")

    class Meta:
        verbose_name = "心理咨询记录"
        verbose_name_plural = "心理咨询记录"

class PsychEvaluation(models.Model):
    """
    心理测评数据表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    EvaluationTime = models.DateTimeField(help_text="时间")
    Problem = models.CharField(max_length=255, help_text="问题")
    SeekingHelp = models.IntegerField(blank=True, null=True, help_text="求助")
    Avoidance = models.IntegerField(blank=True, null=True, help_text="退避")
    Venting = models.IntegerField(blank=True, null=True, help_text="发泄")
    Fantasizing = models.IntegerField(blank=True, null=True, help_text="幻想")
    Endurance = models.IntegerField(blank=True, null=True, help_text="忍耐")
    AnxietyScore = models.FloatField(blank=True, null=True, help_text="焦虑得分")
    DepressionScore = models.FloatField(blank=True, null=True, help_text="抑郁得分")
    EvaluationFile = models.CharField(max_length=100, blank=True, null=True, help_text="测评文件")

    class Meta:
        verbose_name = "心理测评记录"
        verbose_name_plural = "心理测评记录"

class ScholarshipGrant(models.Model):
    """
    奖助学金表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")
    Type = models.CharField(max_length=50, help_text="类型（奖学金/助学金）")
    Level = models.CharField(max_length=50, help_text="等级")
    Semester = models.CharField(max_length=20, help_text="学期")
    Amount = models.FloatField(help_text="金额")

    class Meta:
        verbose_name = "奖助学金记录"
        verbose_name_plural = "奖助学金记录"
class StudentInfo(models.Model):
    """
    学生个人信息表
    """
    StudentID = models.BigAutoField(primary_key=True)
    UserID = models.IntegerField(help_text="用户ID")
    Name = models.CharField(max_length=50, help_text="姓名")
    Gender = models.CharField(max_length=10, help_text="性别")
    BirthDate = models.DateField(help_text="出生年月")
    Avatar = models.CharField(max_length=255, blank=True, null=True,help_text="学生头像")
    Hometown = models.CharField(max_length=100, help_text="户籍所在地")
    SourceLocation = models.CharField(max_length=100, help_text="生源地")
    ParentEducation = models.CharField(max_length=50, blank=True, null=True, help_text="父母教育水平")
    ParentOccupation = models.CharField(max_length=50, blank=True, null=True, help_text="父母职业")
    AdmissionType = models.CharField(max_length=50, help_text="招生形式")
    GaokaoScore = models.IntegerField(blank=True, null=True, help_text="高考成绩")
    EnrollmentDate = models.DateField(help_text="入学时间")
    Major = models.CharField(max_length=50, help_text="专业")
    ClassName = models.IntegerField(help_text="班级")
    PoliticalStatus = models.CharField(max_length=50, blank=True, null=True, help_text="政治面貌")
    Duty = models.CharField(max_length=50, blank=True, null=True, help_text="职务")
    DormitoryNumber = models.CharField(max_length=20, blank=True, null=True, help_text="宿舍号")
    AcademicAdvisor = models.CharField(max_length=50, blank=True, null=True, help_text="学业导师")

    class Meta:
        verbose_name = "学生个人信息"
        verbose_name_plural = "学生个人信息"

class StudentGPA(models.Model):
    """
    学生绩点排名表
    """
    ID = models.AutoField(primary_key=True)
    StudentID = models.BigIntegerField(help_text="学号")  # 关联 StudentInfo
    AcademicYear = models.CharField(max_length=20, help_text="学年学期")
    GPA = models.FloatField(help_text="绩点")
    ClassRank = models.IntegerField(help_text="班级排名")
    MajorRank = models.IntegerField(help_text="专业排名")

    class Meta:
        verbose_name = "学生绩点排名"
        verbose_name_plural = "学生绩点排名"

class MajorCreditRequirement(models.Model):
    """
    每个专业每学期需要修读的学分数
    """
    ID = models.AutoField(primary_key=True)
    Major = models.CharField(max_length=50, help_text="专业名称")
    AcademicYear = models.CharField(max_length=20, help_text="学年")
    RequiredCredits = models.FloatField(help_text="该学期所需修读的学分")

    class Meta:
        verbose_name = "专业学期修读学分要求"
        verbose_name_plural = "专业学期修读学分要求"